package com.gmd.action;


import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.Query;



import com.gmd.model.HistoriaClinica;
import com.gmd.model.Medicamento;
import com.gmd.model.Medico;

import com.gmd.service.ComunService;
import com.gmd.util.Utilitario;


public class BusquedaAction {

	ComunService ser= new ComunService();

	public List<HistoriaClinica> hc;
	public List<Medico> med;
	public List<Medicamento> medic;
	
	public String buscarHC(){
		String retorno="exito";
		EntityManager em = Utilitario.getInstance().
				getEntityManager();
		String jpql="Select o From historiaClinica o";
		Query query=em.createQuery(jpql);
		hc=query.getResultList();
		return retorno;
	}

	public List<HistoriaClinica> gethc() {
		return hc;
	}

	public void sethc(List<HistoriaClinica> hc) {
		this.hc = hc;
	}
	
	public String buscarMed(){
		String retorno="exito";
		EntityManager em = Utilitario.getInstance().
				getEntityManager();
		String jpql="Select o From medico o";
		Query query=em.createQuery(jpql);
		med=query.getResultList();
		return retorno;
	}

	public List<Medico> geMedico() {
		return med;
	}

	public void setMedico(List<Medico> med) {
		this.med = med;
	}
	
	public String buscarMedicamento(){
		String retorno="exito";
		EntityManager em = Utilitario.getInstance().
				getEntityManager();
		String jpql="Select o From medicamento o";
		Query query=em.createQuery(jpql);
		medic=query.getResultList();
		return retorno;
	}

	public List<Medicamento> geMedicamento() {
		return medic;
	}

	public void setMedicamento(List<Medicamento> medic) {
		this.medic = medic;
	}
	
	

		
	
}
